home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 40
/
040.d81
/
math puzzle
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
7KB
|
226 lines
10 poke53280,.:poke53281,.:gosub6000
11 print"[147]"chr$(142)" math puzzle"
12 print" [154]by kevin neelands "
13 print"[156] do you need instructions? (y/n)"
14 getr$:ifr$<>"y"andr$<>"n"then14
15 ifr$<>"y"then20
16 gosub700
17 print"[147]"chr$(142)" math puzzle"
18 print" [154]by kevin neelands "
20 dima(24),c(28,9):y=rnd(-t1)
21 m1$="your guess is correct "
22 m2$="your guess is incorrect[146]"
23 m4$=" .. please no spaces .."
24 m5$=" ** incorrect letter **"
25 m6$=" ** incorrect(= or n)**"
26 m7$=" ** input error **"
27 m8$=" "
30 gosub200 :rem initialize
35 print" "
40 gosub350 :rem display
50 gosub600 :rem check for finish
60 gosub400 :rem input
70 goto40 :rem do it again
200 rem initialize
201 print"[145]do you want two or three addends[153](2[153] or 3[153])"
202 gety$:ify$<>"2"andy$<>"3" then202
203 ym=val(y$)+3
205 print"[145][145][154] how many digits do you wish? ([154]4 - [154]8) "
206 getm$:ifm$<"4"orm$>"8" then 206
207 ifasc(m$)>56orasc(m$)<52thenprint"[145]";:goto205
209 m=val(m$):sc=0:e=0:print"[145][145][129] *** working *** "
210 forx=0to9:b(x)=x+65:a(x+10)=x+38:nextx
220 forx=9to0step-1:y=int(rnd(1)*x+0.5)
230 a(x)=b(y):b(y)=b(x):nextx
234 fory=0to9:forx= 1to10:c(x,y)=21:nextx:nexty
236 fory=0to9:forx=11to28:c(x,y)=20:nextx:nexty
238 fory=0to9:c(0,y)=10:nexty
239 fory=2toym:c(0,y)=28:nexty
240 a(20)=32:a(21)=asc("?"):a(22)=asc("*"):a(23)=asc("[215]"):c(20+m,2)=0:a(24)=43
250 forx=20+mto21step-1:c(x,3)=int(rnd(1)*10):c(x,4)=int(rnd(1)*10)
260 d=c(x,2)+c(x,3)+c(x,4)
265 ifym=6thenc(x,5)=int(rnd(1)*10):d=d+c(x,5)
266 ifd>19thenc(x-1,2)=2:c(x,ym)=d-20:nextx:goto294
270 ifd>9thenc(x-1,2)=1:c(x,ym)=d-10:nextx:goto294
280 c(x-1,2)=0:c(x,ym)=d:nextx
294 c(20,3)=20:c(20,ym-1)=24:c(20,ym)=c(20,2):c(20+m,2)=20
295 print"[145][145][156] would you like the expert level (y/n)"
296 getrg$:ifrg$=""then296
298 ifrg$="y"thenforx=20to28:c(x,2)=20:nextx
300 printchr$(147);" ":return
350 print" [154]press return [154]alone to exit"
351 print" math puzzle"
352 print" [154] by kevin neelands
353 [153]"sys" m3$
354 [153]" "
355 [153]" contabcdefghij scoresys";sc""
360 [129]y[178]0[164]9:d$[178]"cont"[170][196](y)[170]"open ": [129]x[178]1[164]c(0,y)
370 d$[178]d$[170][199](a(c(x,y))):[130]x:[153]d$
380 [130]y:[153]" ":[142]
400 [143] input
410 [153]"forplease enter your guess print#: ";:e[178]0
411 [129]x[178]1[164]14:[153][199](20);:[130]x
415 [141]8000:g$[178]a$:[153]" "
420 l$[178][200](g$,1):e$[178][202](g$,2,1):n$[178][201](g$,1)
425 [129]x[178]1[164][195](g$):[139][202](g$,x,1)[178]" "[167]m3$[178]m4$:[141]350:e[178]1
426 [130]x:[139]e[178]1[167]410
430 [139][198](l$)[177]74[176][198](l$)[179]65[167]m3$[178]m5$:[141]350:[137]410
440 [139]e$[179][177]"="[175]e$[179][177]"n"[167]m3$[178]m6$:[141]350:[137]410
450 [129]x[178]3[164][195](g$)
452 [139][198]([202](g$,x,1))[177]57[176][198]([202](g$,x,1))[179]48[167]m3$[178]m7$:[141]350:e[178]1
454 [130]x:[139]e[178]1[167]410
460 n[178][197](n$):l[178][198](l$)[171]64:m3$[178]m1$
470 [139](c(l,n)[178]22)[176](c(l,n)[178]23)[167]m3$[178]m8$:[137]541
480 [139](a(n)[178]l[170]64)[167]495
485 [139]e$[178]"n"[167]sc[178]sc[170]1:c(l,n)[178]22:[153][199](19):[153]"sys"m3$:[137]540
490 c(l,n)[178]22:[153][199](19):m3$[178]m2$:[153]"sys"m3$:[137]540
495 [139]e$[178]"="[167][153][199](19):[153]"sys"m1$:[137]500
496 [153][199](19):m3$[178]m2$:[153]"sys"m3$
500 [129]y[178]0[164]9:[139]c(l,y)[179][177]22[167][139]e$[178]"="[167]sc[178]sc[170]1
510 c(l,y)[178]22:[130]y
520 [129]x[178]1[164]10:[139]c(x,n)[179][177]22[167][139]e$[178]"="[167]sc[178]sc[170]1
530 c(x,n)[178]22:[130]x:c(l,n)[178]23
540 [139]a(n)[178]l[170]64[167]a(n)[178]n[170]48
541 [139][195](g$)[177]3[167]g$[178][200](g$,[195](g$)[171]1):n$[178][201](g$,1):[137]460
545 [142]
600 [143] check for alllthru
610 [129]x[178]21[164]20[170]m:[129]y[178]2[164]ym
620 [139]a(c(x,y))[177]57[167][142]
630 [130]y:[130]x
640 [129]x[178]1[164]10:[129]y[178]0[164]9
650 [139]c(x,y)[178]21[167]sc[178]sc[170]1
660 [130]y:[130]x
666 [141]350
670 [153]"clr do you wish to play again? (y/n) "
671 [161]a$:[139]a$[178]""[167]671
672 [139]a$[178]"n"[167]680
673 [139]a$[178]"y"[167]675
674 [137] 671
675 m3$[178]m8$:[137]30
680 [153]"on do you wish to quit? (y/n) "
681 [161]a$:[139]a$[178]"y"[167]690
682 [139]a$[178]"n"[167][153]"on";:[137]670
683 [137] 681
684 :
685 [143] is loadstar there? if so loadit
686 :
690 [159]15,8,15,"r0:hello connect=hello connect":[132]15,er:[160]15
691 [139]er[179][177]63 [167][153]"load":[128]
695 [147] "hello connect",8,1
696 :
697 :
698 :
699 :
700 in$[178]"loadinstructionscont"[170][199](13)
710 [153]in$"cont this program provides you with puzzles"
720 [153]"that consist of addition problems that"
725 [153]"have been coded by randomly substit-"
730 [153]"uting the digits with the letters a-j"
735 [153]"in a consistent manner. ":[153]"for example-":[153]" "
740 [153]" 0100 jgjj"
745 [153]" 1634 -> gfch"
750 [153]" +4552 +hiid"
755 [153]" 06786 jfabf"
760 [153]" ":[153]"is one possible puzzle."
762 [153]"you would be given the puzzle on the"
763 [153]"right and have to decode it to the"
764 [153]"problem on the left."
765 [153]"note that all 'carried digits' are"
766 [153]"shown (the 1's and 0's in the top row)"
770 [153]"press any key when ready to continue"
771 [161]a$:[139]a$[178]""[167]771
780 [153]in$"cont you can make guesses two ways:"
790 [153]" aprint#)cont equal guesses, such as f=2 "
800 [153]" (f is equal to 2)"
810 [153]" bprint#)cont not equal guesses, such as an1"
820 [153]" or cn1357, meaning a is not 1"
830 [153]" and c is not 1,3,5 or 7,"
840 [153]" respectively. n means not equal"
850 [153]"note that your guess should have no "
855 [153]"spaces and if you use a not equal guess"
860 [153]"you may guess that the letter is not"
870 [153]"equal to a series of numbers"
880 [153]"press any key when ready to continue"
881 [161]a$:[139]a$[178]""[167] 881
890 [153]in$"cont most of your guesses will probaly be"
900 [153]"of the not equal type, so to help you"
910 [153]"keep track of the possible values for"
920 [153]"each letter a 'possibility grid' will"
930 [153]"be shown on the screen. its columns "
940 [153]"will correspond to letters and its"
950 [153]"rows will correspond to numbers. the"
960 [153]"grid will be filled with these symbols:"
970 [153]" ?cont question marks indicate that the"
980 [153]" letter is unknown. it may or "
990 [153]" may not be equal to the
1000 print" corresponding number."
1010 :
1020 print" *[154] this means the letter on this"
1030 print" column is not equal to the number"
1040 print" on this row"
1050 print" [215][154] this means this letter is equal to"
1060 print" this number, and has been replaced"
1070 print" by it in the problem"
1080 print" ":print"press any key when ready to continue"
1081 geta$:ifa$=""then1081
1090 printin$"are you a little confused? my advice"
1100 print"is to play a couple of practice rounds"
1110 print"and it will all make sense"
1120 print"when the game starts you will be given"
1130 print"choices as to the number of addends"
1140 print"to be added, the number of digits in"
1150 print"each addend, and whether or not you"
1160 print"want the expert level. if you choose"
1170 print"the expert level the carried digits "
1180 print"will not be shown and the puzzle will"
1190 print"be harder"
1191 print"you can also quit by pressing return"
1192 print"alone at the guess prompt."
1200 print"by the way-perfect score is 100."
1210 print"press any key when ready to continue"
1220 geta$:ifa$=""then1220
1222 print"[147]":return
6000 :
6010 print"[147]"
6020 print" [158]L O A D S T A R"
6030 print" [152][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163]"
6040 print
6050 print" [154]Presents"
6060 print
6070 print
6080 print"